package com.spboot.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.spboot.entity.Like;
import com.spboot.entity.Type;
import com.spboot.page.PageInfo;
import com.spboot.service.InformationService;
import com.spboot.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author guocb
 * @since 2020-04-27
 */
@Controller
@RequestMapping("/type")
public class TypeController {
    @Autowired
    TypeService typeService;

    @Autowired
    InformationService informationService;

    /**
     * 后台查询分类
     * @param model
     * @return
     */
    @RequestMapping("stype")
    public String htype(@RequestParam(defaultValue = "1", required = false) Long pageno, Model model){
        QueryWrapper<Type> queryWrapper = new QueryWrapper<>();
        PageInfo<Type> pageInfo = new PageInfo<>(pageno, 8);
        pageInfo = (PageInfo<Type>) typeService.selecttype(pageInfo, queryWrapper);
        model.addAttribute("typelist",pageInfo);
        return "Htype";
    }
}

